package com.pingpang.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import com.pingpang.interceptor.LoginHandlerInterceptor;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
	/**
	 * 不需要登录拦截的url
	 */
	final String[] notLoginInterceptPaths = { "/css/**",
			                                  "/font/**",
			                                  "/images/**",
			                                  "/lay/**",
			                                  "/mobile/**",
			                                  "/theme/**",
			                                  "/druid/**",
			                                  "/user/chat"};

	@Override
	public void addInterceptors(InterceptorRegistry registry) {
		registry.addInterceptor(new LoginHandlerInterceptor()).addPathPatterns("/**").excludePathPatterns(notLoginInterceptPaths);
	}
}
